# -*- coding: utf-8 -*-
# 此处修改配置参数
from os import getenv, path

certs_path = path.join(path.dirname(__file__), 'static/certs')


class Config(object):
    DEBUG = bool(getenv("DEBUG"))
    TESTING = False
    SECRET_KEY = "8f06129284964ee7822fad07b6795718"
    PORT = int(getenv("PORT"))

    UPLOAD_PATH = r"server/static/images"
    IMAGE_URL = "http://localhost:9690/static/images/"

    DB_ADDRESS = getenv("DB_ADDRESS")
    DATABASE = getenv("DATABASE")
    DB_USER = getenv("DB_USER")
    DB_PASSWORD = getenv("DB_PASSWORD")
    SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://%s:%s@%s:3306/%s?charset=utf8' % (DB_USER, DB_PASSWORD, DB_ADDRESS, DATABASE)

    SQLALCHEMY_TRACK_MODIFICATIONS = False
    SQLALCHEMY_POOL_SIZE = 10600
    SQLALCHEMY_POOL_TIMEOUT = 200
    SQLALCHEMY_POOL_RECYCLE = 10600

    REDIS_HOST = "localhost"
    REDIS_PORT = 6379
    REDIS_DB = 0
    REDIS_EXPIRE = 60

    # 微信支付初始化
    WECHAT_TOKEN = 'token'
    WECHAT_APPID = getenv("WECHAT_APPID")
    WECHAT_SECRET = getenv("WECHAT_SECRET")

    WECHAT_PAY_API_KEY = getenv("WECHAT_PAY_API_KEY")
    WECHAT_PAY_MCH_ID = getenv("WECHAT_PAY_MCH_ID")
    WECHAT_PAY_SUB_MCH_ID = None
    WECHAT_PAY_MCH_CERT = path.join(certs_path, "apiclient_cert.pem")
    WECHAT_PAY_MCH_KEY = path.join(certs_path, "apiclient_key.pem")
